<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTTP vs HTTPS：深入理解网络安全协议</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .first-letter::first-letter {
            font-size: 3.5rem;
            font-weight: 700;
            float: left;
            line-height: 1;
            margin-right: 0.1em;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        .section-title {
            position: relative;
            padding-left: 1.5rem;
        }
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 80%;
            background: linear-gradient(to bottom, #667eea, #764ba2);
        }
        .feature-icon {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        .comparison-card {
            backdrop-filter: blur(10px);
            background: rgba(255, 255, 255, 0.9);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center">
            <h1 class="text-5xl md:text-6xl font-bold mb-6 tracking-tight">
                HTTP vs HTTPS
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                深入理解网络安全协议的本质差异
            </p>
            <div class="flex justify-center space-x-8 text-lg">
                <div class="flex items-center">
                    <i class="fas fa-lock mr-2"></i>
                    <span>数据加密</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-shield-alt mr-2"></i>
                    <span>身份验证</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-user-shield mr-2"></i>
                    <span>隐私保护</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-7xl mx-auto px-6 py-12">
        <!-- Introduction -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12 card-hover">
            <p class="text-lg leading-relaxed text-gray-700 first-letter">
                HTTP 和 HTTPS 的主要区别在于安全性。HTTP 是一种无加密的协议，适用于对安全要求不高的场景；而 HTTPS 则通过加密和证书验证确保了数据的安全和完整性，是处理敏感信息和保护用户隐私的必需选择。现代互联网中，HTTPS 已成为确保数据传输安全的标准。
            </p>
        </div>

        <!-- Visual Comparison -->
        <div class="grid md:grid-cols-2 gap-8 mb-12">
            <div class="comparison-card rounded-2xl p-8 border-2 border-gray-200 card-hover">
                <div class="text-center mb-6">
                    <i class="fas fa-globe text-6xl text-gray-400 mb-4"></i>
                    <h2 class="text-3xl font-bold text-gray-800">HTTP</h2>
                    <p class="text-gray-600 mt-2">超文本传输协议</p>
                </div>
                <div class="space-y-4">
                    <div class="flex items-start">
                        <i class="fas fa-times-circle text-red-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">明文传输，数据未加密</span>
                    </div>
                    <div class="flex items-start">
                        <i class="fas fa-times-circle text-red-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">容易被窃听和篡改</span>
                    </div>
                    <div class="flex items-start">
                        <i class="fas fa-info-circle text-blue-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">默认端口：80</span>
                    </div>
                </div>
            </div>
            <div class="comparison-card rounded-2xl p-8 border-2 border-purple-400 card-hover">
                <div class="text-center mb-6">
                    <i class="fas fa-lock text-6xl feature-icon mb-4"></i>
                    <h2 class="text-3xl font-bold text-gray-800">HTTPS</h2>
                    <p class="text-gray-600 mt-2">安全超文本传输协议</p>
                </div>
                <div class="space-y-4">
                    <div class="flex items-start">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">SSL/TLS 加密传输</span>
                    </div>
                    <div class="flex items-start">
                        <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">数据安全性和完整性保证</span>
                    </div>
                    <div class="flex items-start">
                        <i class="fas fa-info-circle text-blue-500 mt-1 mr-3"></i>
                        <span class="text-gray-700">默认端口：443</span>
                    </div>
                </div>
            </div>
        </div>

        <!-- Mermaid Diagram -->
        <div class="bg-white rounded-2xl shadow-xl p-8 mb-12">
            <h2 class="text-3xl font-bold text-gray-800 mb-6 section-title">协议架构对比</h2>
            <div class="mermaid">
                graph TB
                    subgraph "HTTP 通信流程"
                        A1[客户端] -->|明文请求| B1[服务器]
                        B1 -->|明文响应| A1
                        C1[中间人] -.->|可以窃听/篡改| B1
                    end
                    
                    subgraph "HTTPS 通信流程"
                        A2[客户端] -->|SSL握手| B2[服务器]
                        B2 -->|证书验证| A2
                        A2 -->|加密请求| B2
                        B2 -->|加密响应| A2
                        C2[中间人] -.->|无法解密| B2
                    end
                    
                    style A1 fill:#ff6b6b
                    style B1 fill:#ff6b6b
                    style C1 fill:#ffd93d
                    style A2 fill:#4ecdc4
                    style B2 fill:#4ecdc4
                    style C2 fill:#95e1d3
            </div>
        </div>

        <!-- Detailed Comparison -->
        <div class="space-y-8">
            <!-- 基本定义 -->
            <div class="bg-white rounded-2xl shadow-xl p-8 card-hover">
                <h3 class="text-2xl font-bold text-gray-800 mb-4 section-title">
                    <i class="fas fa-book mr-2 text-purple-600"></i>基本定义
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-gray-50 rounded-lg p-6">
                        <h4 class="font-bold text-lg text-gray-800 mb-2">HTTP</h4>
                        <p class="text-gray-700">Hypertext Transfer Protocol，用于在网络上发送和接收数据，主要用于从服务器获取网页内容。HTTP 是一个明文协议，数据在传输过程中没有任何加密。</p>
                    </div>
                    <div class="bg-purple-50 rounded-lg p-6">
                        <h4 class="font-bold text-lg text-gray-800 mb-2">HTTPS</h4>
                        <p class="text-gray-700">Hypertext Transfer Protocol Secure，是在 HTTP 基础上添加了安全层（SSL/TLS）来加密数据传输的协议。HTTPS 通过加密确保了数据在网络传输中的安全性和完整性。</p>
                    </div>
                </div>
            </div>

            <!-- 安全性 -->
            <div class="bg-white rounded-2xl shadow-xl p-8 card-hover">
                <h3 class="text-2xl font-bold text-gray-800 mb-4 section-title">
                    <i class="fas fa-shield-alt mr-2 text-purple-600"></i>安全性
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-red-50 rounded-lg p-6 border-l-4 border-red-400">
                        <h4 class="font-bold text-lg text-gray-800 mb-2">HTTP</h4>
                        <p class="text-gray-700">数据在传输过程中是以明文形式传送的，任何在网络中间的节点（如黑客）都可以拦截、读取或篡改这些数据。HTTP 不提供任何保护措施。</p>
                    </div>
                    <div class="bg-green-50 rounded-lg p-6 border-l-4 border-green-400">
                        <h4 class="font-bold text-lg text-gray-800 mb-2">HTTPS</h4>
                        <p class="text-gray-700">使用 SSL（安全套接层）或 TLS（传输层安全协议）对数据进行加密，确保数据在传输过程中不会被第三方窃听或篡改。它还提供身份验证，确保数据发送到正确的服务器。</p>
                    </div>
                </div>
            </div>

            <!-- 数据加密 -->
            <div class="bg-white rounded-2xl shadow-xl p-8 card-hover">
                <h3 class="text-2xl font-bold text-gray-800 mb-4 section-title">
                    <i class="fas fa-key mr-2 text-purple-600"></i>数据加密
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-gray-50 rounded-lg p-6">
                        <h4 class="font-bold text-lg text-gray-800 mb-2">HTTP</h4>
                        <p class="text-gray-700">没有加密功能，所有传输的数据都是明文的。</p>
                        <div class="mt-4 p-4 bg-red-100 rounded-lg">
                            <i class="fas fa-exclamation-triangle text-red-600 mr-2"></i>
                            <span class="text-sm text-red-700">风险：数据可被轻易截获</span>
                        </div>
                    </div>
                    <div class="bg-purple-50 rounded-lg p-6">
                        <h4 class="font-bold text-lg text-gray-800 mb-2">HTTPS</h4>
                        <p class="text-gray-700">数据通过加密算法进行加密，使得即使数据被拦截，也无法被读取或篡改。加密和解密过程是通过公钥和私钥完成的。</p>
                        <div class="mt-4 p-4 bg-green-100 rounded-lg">
                            <i class="fas fa-check-circle text-green-600 mr-2"></i>
                            <span class="text-sm text-green-700">保护：端到端加密传输</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 技术细节 -->
            <div class="bg-gradient-to-r from-purple-50 to-blue-50 rounded-2xl p-8">
                <h3 class="text-2xl font-bold text-gray-800 mb-6 text-center">技术参数对比</h3>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="bg-white rounded-lg p-6 text-center card-hover">
                        <i class="fas fa-network-wired text-4xl text-purple-600 mb-4"></i>
                        <h4 class="font-bold text-lg mb-2">端口号</h4>
                        <p class="text-gray-600">HTTP: 80</p>
                        <p class="text-gray-600">HTTPS: 443</p>
                    </div>
                